﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AffinityORMLibrary.DataTypes;
using System.Configuration;

namespace AffinityORMLibrary.DataLayer.Factory
{
    class SysTableFactory
    {
        public List<SysTable> GetSysTables(ConnectionStringSettings connectionString)
        {
            List<SysTable> result = new List<SysTable>();
            SysTableInfoFactory tableInfoFactory = new SysTableInfoFactory(connectionString);
            List<SysTableInfo> tableInfos = tableInfoFactory.GetSysTableInfo();
            foreach (SysTableInfo info in tableInfos)
            {
                SysTable table = new SysTable();
                table.TableInfo = info;
                SysTableColumnFactory columnFactory = new SysTableColumnFactory(connectionString);
                List<SysTableColumn> columns = columnFactory.GetSysTableColumns(info);
                table.Columns = columns;
                result.Add(table);
            }
            return result;
        }
    }
}
